package com.sywb.chuangyebao.contract;

import android.view.View;

import com.sywb.chuangyebao.bean.Answer;

public interface AnswerReplyContract {

    interface AnswerCommentView extends AnswerCommentContract.AnswerCommentView {

        Answer getAnswer();

        void setReplyName(String name);
    }

    class Presenter extends AnswerCommentContract.Presenter<AnswerCommentView> implements View.OnClickListener {

        @Override
        public void onStart() {
            super.onStart();
            answer = mView.getAnswer();
            answer.isReply = true;
            oAnswer = answer;
//            mView.setCommentCount(answer.answer_num);

            initData();
        }

        @Override
        public void initData() {
            super.initData();
            pageNo = 1;
            initCommentData();
        }

        @Override
        public void isNoData() {
            super.isNoData();
//            mView.setCommentCount(recyclerAdapter.getDataCount());
            if (pageNo == 1) {
                recyclerAdapter.addData(0, oAnswer);
            }

        }

        @Override
        protected void doOnAgreeSuccess(String topic_Type, Answer clickAnswer) {
            super.doOnAgreeSuccess(topic_Type, answer);
            recyclerAdapter.notifyDataSetChanged();
        }

        @Override
        protected void initClickedItem(int i) {
            super.initClickedItem(i);
            answer = recyclerAdapter.getItem(i);
        }

        @Override
        public void onRecyclerItemClick(int i) {
            super.onRecyclerItemClick(i);
            answer = recyclerAdapter.getItem(i);
            mView.setReplyName("人名：" + answer.display_name);
        }

    }
}

